import {ListModel, PageModel} from './common';

// flow
class ProcessStageModel {
  public name: string;
  public order: string;
  public executors: string;
  public observers: string;
  public passType: string;
  public canReject: string;
  public executionTime: string;
  public alarm: string;
  public earlyWarningTime: string;
  public passTime: string;
  public description: string;
  public id: string;
}

class FlowProcessGroupModel {
  public name: string;
  public type: string;
  public id: string;
  public projectId: string;
  public createAt: number;
  public updateAt: number;
}

class FlowModel {
  public id: string;
  public projectId: string;
  public name: string;
  public creator: string;
  public description: string;
  public groupModel: FlowProcessGroupModel;
  public observers: string[];
  public stageModels: ProcessStageModel[];
  public createAt: number;
  public updateAt: number;
}

class FlowListModel {
  public items: FlowModel[];
  public count: number;
}

class FlowPageModel extends PageModel {
  public data: FlowListModel;
}


// task
class TaskModel {
  public id: string;
  public projectId: string;
  public status: string;
  public creator: string;
  public name: string;
  public deadline: string;
  public open: boolean;
  public processName: string;
  public processId: string;
  public stageModels: TaskStageModel[];
  public currentStage: string;
  public historyModels: HistoryModel[];
  public enclosureModels: TaskEnclosureModel[];
  public comments: TaskCommentModel[];
  public todoModels: TaskTodoModel[];
  public observers: string[];
  public pubdate: string;
  public createAt: string;
  public updateAt: string;
  public privilege: TaskPrivilegeModel;
  public overdue: boolean;
  public archivedBy : string;
}

class TaskCommentModel {
  public id: string;
  public commentId: string;
  public name: string;
}

class TaskStageModel {
  public name: string;
  public order: number;
  public executors: string[];
  public observers: string[];
  public passType: string;
  public canReject: boolean;
  public executionTime: number;
  public alarm: boolean;
  public earlyWarningTime: number;
  public passTime: number;
  public description: string;
  public id: string;
}

class TaskEnclosureModel {
  public resourceUrn: string;
  public resourceOwner: string;
  public userData: string;
  public id: string;
}

class HistoryModel {
  public type : number;
  public operator : string;
  public content: string;
  public description : string;
  public stageId: string;
  public id: string;
  public createAt: number;
}

class TaskTodoModel {
  public id: string;
  public finish: boolean;
  public content: boolean;
}

class TaskPrivilegeModel {
  public action: number;
  public canArchived: boolean;
  public canModifyComment: boolean;
  public canModifyDeadline: boolean;
  public canModifyEnclosure: boolean;
  public canModifyName: boolean;
  public canModifyObserver: boolean;
  public canModifyOpen: boolean;
  public canModifyParticipant: boolean;
  public canModifyTodo: boolean;
  public canModifyType: boolean;
  public canDelete: boolean;
  public canStop: boolean;
}

class TaskListModel extends ListModel {
  public items: TaskModel[];
}

class TaskPageModel extends PageModel {
  public data: TaskListModel;
}

// group
class FlowGroupModel {
  public name: string;
  public type: string;
  public id: string;
  public projectId: string;
  public createAt: number;
  public updateAt: number;
}

class FlowGroupListModel {
  public items: FlowGroupModel[];
  public count: number;
}

class FlowGroupPageModel extends PageModel {
  public data: FlowGroupListModel;
}

export {
  TaskPageModel,
  TaskModel,
  TaskStageModel,
  TaskEnclosureModel,
  TaskCommentModel,
  TaskTodoModel,
  FlowPageModel,
  ProcessStageModel,
  FlowModel,
  FlowGroupModel,
  FlowGroupListModel,
  FlowGroupPageModel
};
